﻿ 
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="VideosByTag.aspx.vb" Inherits="_3dBuzz.VideosByTag1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
    <br />
</p>
<p>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource1" AllowSorting="True">
        <Columns>
            <asp:BoundField DataField="Tags" HeaderText="Tags" SortExpression="Tags" >
            <HeaderStyle CssClass="columnhead" />
            </asp:BoundField>
            <asp:BoundField DataField="Title" HeaderText="Video Title" 
                SortExpression="Title" >
             
            <HeaderStyle CssClass="columnhead" />
            </asp:BoundField>
             
            <asp:HyperLinkField DataNavigateUrlFields="VideoId" 
                DataNavigateUrlFormatString="VideoDetail.aspx?VideoId={0}" HeaderText="View Video" 
                Text="Select" >
             
            <HeaderStyle CssClass="columnhead" />
            </asp:HyperLinkField>
             
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:3dBuzzDatabase %>" 
        ProviderName="<%$ ConnectionStrings:3dBuzzDatabase.ProviderName %>" SelectCommand="  SELECT  DISTINCT Tags.[Tags], Video.[Title], Video.[VideoId]
FROM Video INNER JOIN (Tags INNER JOIN VideoTagJunction ON Tags.[ID] = VideoTagJunction.[Tag_fkid]) ON Video.[VideoId] = VideoTagJunction.[Video_fkid]

"></asp:SqlDataSource>
</p>
<p>
</p>
</asp:Content>
